package com.sxyjhh.service.data_exchange;

import com.sxyjhh.common.DBConfig;
import com.sxyjhh.create.api.DataApi;
import com.sxyjhh.schedule.TaskRunnable;
import com.sxyjhh.utils.CommonUtils;

import java.sql.SQLException;
import java.util.Date;

/**
 * Created by Administrator on 2018/6/15.
 */
//数据对比线程
public class DataExchangeRunnable extends TaskRunnable {

    private DataExchangeService dataExchangeService;
    private String tabName;
    private String key;
    private DataApi ri;

    public DataExchangeRunnable( DataExchangeService dataExchangeService,
                                String tabName, String key, DataApi ri) {
        this.taskId = "dataGet-"+tabName;
        this.dataExchangeService = dataExchangeService;
        this.key = key;
        this.tabName = tabName;
        this.ri = ri;
    }

    @Override
    public synchronized void run() {
        System.out.println("——————————————————————ThreadName————————————————————————");
        System.out.println(Thread.currentThread().getName());
        System.out.println("——————————————————————TaskName————————————————————————");
        System.out.println(taskId);
        System.out.println("——————————————————————possTime————————————————————————");
        System.out.println(CommonUtils.YYYYMMDDHHMMSS.format(new Date()));


        try {
            dataExchangeService.getData(tabName,tabName,key,ri,0,"");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
